#!/usr/bin/perl -w
#开始转码的任务
	unless (open FH, "-|") {

  		exec "ffmpeg -y -i /var/shandiangou.mov kkk.mp4 -acodec copy -vcodec copy -f mp4 2>&1|tr '\r' '\n'";        # 用exec执行另一个程序
  		exit;
	}
	while (<FH>) {

          $s_tt = $_;
	
	  print "$s_tt [end] \n";


          $index_found = index($s_tt, "time=");

	  print "index_found = $index_found";
          if($index_found > 0) {
	    
	    $s_tt0 = substr($s_tt, $index_found, length($s_tt)-$index_found);
            @a_a0 = split(/ /, $s_tt0);
            @a_a1 = split(/=/, $a_a0[0]);

	}
#如果判断显示“ global headers"则认为该视频已经完成

	  $index_found = index($s_tt, "global headers");
	  if($index_found >=0) {

		$flag = "success";
		setTaskStatus($rid, "success");
	  }

	}
